/**
 * Created by smp on 2017/5/12.
 */
var modelPath=ROOT_PATH+'/majorHazard/technicalReport/';
/**
 * 成功回掉事件
 * @param data
 */
function successCallback(data){

    if(data.success){
        layer.msg(data.message,{time:1000,icon:1},function () {
            WindowManager.closeLayer({
                returnValue:''
            });
        });

    }else{
        layer.msg(data.message,{time:1000,icon:2});
    }

}
$(function () {
    $('#btn_verify').on('click', function () {

        var index = layer.confirm('是否确定提交，提交之后不可编辑？', {
            btn: ['确定', '取消'] //按钮
        }, function () {
            $('#submit_form').form('submit', {
                url: modelPath + 'verify.shtml',
                onSubmit: function (param) {
                    var isValid = $(this).form('validate');
                    if (!isValid) {
                        layer.close(index);
                        layer.msg("请正确填写表单")
                    }
                    param["state"] = "已审核";
                    return $(this).form('validate');
                },
                success: function (result) {
                    var data = $.parseJSON(result);
                    successCallback(data)
                }
            });
        });

    });

});